Home

Week 8 - Embedded Programming

The Task

  • Read a microcontroller data sheet
  • Program your board to do something with as many different programming languages and programming environments as possible
  • Reading the Data Sheet

    The micro-controller on our board is the Attiny44, the data sheet can be found here.

    Whilst having an overwhelming amount of information, some key points can be gleaned.

  • Pinout Numbering
  • Uses of the Pins
  • Programming the Board

    Arduino Environment

    In order to program using the Arduino environment download the following items:

  • Attiny hardware files
  • Arduino software for your operating system here
  • FTDI serial cable driver from here.
  • Install the FTDI driver and the Arduino environment. Locate the Arduino file location (Arduino > Preferences) and save the ATtiny hardware in a new file called HARDWARE.

    After installing the software and drivers plug in the fabisp and Hello LED + Button Boards and change the following Settings in Arduino

  • Tools > Board > Attiny 44 (20Mhz)
  • Tools > Programmer > USBTinyISP
  • Tools > Serial Port (this will vary depending on your port nomenclature, mine was as below.
  • Then, Tools > BurnBootloader
  • The board is now ready to program.

    Go to File > Examples > 02. Digital > Button Provides a code example for programming the LED+BUTTON.
    In order to use this file the assigning of pin numbers needs to be altered to suit your board. The Arduino numbering system is not the same as ATTINY Use the table below to assign the correct pins.

    ATTINY PIN #PIN FNARDUINO #
    1VCCVCC
    2PBO10
    3PB19
    4PB3RESET
    5PB28
    6PA77
    7PA66
    8PA55
    9PA44
    10PA33
    11PA22
    12PA11
    13PA00
    14GNDGND


    I used attiny pins 6 & 10 which corresponded to 7 & 3 on the Arduino.

    Press the upload button (arrow) and the program is loaded onto the HELLO BUTTON+LED.
    Your LED should now be on and remain on until the button in pressed. Note that you can disconnect the isp and it will still work if powered.

    You can reverse the effect of the button by changing the line in the void state from high to low as shown below.

    The LED will now remain off, unless the button is pressed.

    Some helpful arduino commands to alter this code can be found here.

    I used the delay command to add a delay after the button was pressed, here 500ms.

    The example code Basics > Blink can be trialled also.



    Crosspack Environment - C code - MAC

  • Connect boards and open Arduino Software
  • Download and install the CrosspackAVR software. If you programmed your FABIsp on mac in week 4 you should already have this. Otherwise, follow these instructions.
  • Download Neils hello.ftdi.44.echo.c file and the hello.ftdi.44.echo.c.make file. I saved these to desktop to make navigating to them in Terminal easier

  • NOTE: I was recieving an error message when I initially tried this approach. The .c file must be modified now - open using text editor/xcode and add CONST to the start of line 216 The line should now read:

    const static char message[] PROGMEM = "hello.ftdi.44.echo.c: you typed \"";

    To enable line number view on xcode go to xcode > preferences > text editing > show line numbers

  • Open Terminal and navigate to the File location cd Desktop/
  • Write the command

    sudo make -f hello.ftdi.44.echo.c.make program-usbtiny

  • This uses the make file to generate a hex code, then uses that to program the microcontroller


  • You can now open Tools > Serial Monitor in arduino and communicate with the board (albeit one letter at a time)


  • The baud rate should be set to maximum - 115200 bps



    Making the FABDUINO

    This week I also made Neil's FABDUINO.

    I generated a g-code toolpath for the sherline using fabmodules. After a poorly milled first attempt I changed to the following settings with good results

  • 1/64 mill end, 1 offset, diam 0.42

  • Then cut at a max vel of 93mm/min and Jog 93mm/min

    Got the green light after soldering

    Currently trying to de-bug an issue with the using the 328 (non-p) type micro-controller.

    update 31/03/13 Issue Resolved - Please read these Instructions for using the ATMEGA328 (non-p) micro-controller.